import React from "react";
import classNames from "classnames";
import { useHistory } from "react-router-dom";
import "./index.less";
import { routeArray } from "../../common/route/routeConfig";
export default function Demo(props: any) {
  const { prefixCls = "m-react-home" } = props;
  const className = classNames({
    [prefixCls]: true,
  });
  const history = useHistory();
  const goPages = (path) => () => {
    history.push(`${path}`);
  };
  return (
    <div className={className}>
      {routeArray.map(
        (item) =>
          item.title && (
            <div className="list" key={item.id} onClick={goPages(item.path)}>
              {item.title}
            </div>
          )
      )}
    </div>
  );
}
